package com.example.dao.imp;

import com.example.dao.EmployeeDao;
import com.example.entity.EmployeeEntity;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.DetachedCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public class EmployeeDaoImp implements EmployeeDao {

    @Autowired
    SessionFactory sessionFactory;

    @Override
    public List<EmployeeEntity> getEmployeeList(DetachedCriteria detachedCriteria) {
        Session session=sessionFactory.openSession();
        Criteria criteria=detachedCriteria.getExecutableCriteria(session);
        List<EmployeeEntity> list=criteria.list();

        return list;
    }


}
